<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    body{
      margin: 0;
      display: flex;
      justify-content: center;
      align-items: center;
      min-height: 100vh;
    }
    .box{
      width: 150px;
      height: 150px;
      background: url('http://c3.staticflickr.com/3/2671/3904743709_74bc76d5ac_b.jpg');
      background-size: auto 100%;
      /* 动画默认暂停,鼠标移入时才执行,鼠标移除时暂停 而不会生硬的跳到第一帧 */
      animation: slide 5s linear infinite alternate;
      animation-play-state: paused;
    }
    .box:hover{
      animation-play-state: running;
    }
    @keyframes slide {
      to { background-position: 100% 0; }
    }
  </style>
</head>
<body>
  <div class="box"></div>
</body>
</html>